<?php
require_once 'EZend/Controller/AdminBaseController.php';

class Admin_LogoutController extends AdminBaseController {
	
	public function indexAction() {
		$session = $this->getCurrentAdminUser()->getUserInfo('session');
		if (!$session) return $this->showNotice('你没有登录，无需登出');
		
		$this->getAdminSessionService()->deleteSession($session['session_id']);
		$this->_redirect($this->getInnerUrl(array('module' => 'admin', 'controller' => 'login')));
	}
	
	protected function getAdminSessionService() {
		require_once 'Models/Admin/Service/AdminServiceFactory.php';
		return AdminServiceFactory::getInstance()->createAdminSessionService();
	}
}
